package com.lanyam.travel.base.dao;

import java.util.Date;
import java.util.List;

import org.apache.ibatis.annotations.Select;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lanyam.travel.base.entity.GoodsDate;

import io.lettuce.core.dynamic.annotation.Param;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author rosson
 * @since 2020-01-29
 */
public interface GoodsDateMapper extends BaseMapper<GoodsDate> {

	@Select("select max(the_date) as latestDate from goods_date where goods_id = #{productId} ")
	Date queryMaxDate(String productId);

	@Select("select * from goods_date where goods_id = #{id} and DATE_FORMAT(the_date, '%Y/%m') = DATE_FORMAT(#{month}, '%Y/%m')")
	List<GoodsDate> queryGoodsDateByMouth(String id, Date month);

}
